﻿using AutoMapper;
using Microsoft.AspNetCore.Mvc;
using sixgod.Base.Controllers;
using sixgod.Dtos.User;
using sixgod.Service.User;
using sixgod.Service.User.Implementation;

namespace sixgod.Module.User.Controllers
{
    [Route("[Controller]")]
    public class DepartmentController:BaseController
    {
        private readonly IDepartmentService _departmentService;
        private readonly IMapper _mapper;

        public DepartmentController( IMapper mapper, IDepartmentService departmentService)
        {
            _mapper = mapper;
            _departmentService = departmentService;
        }

        [HttpGet("all")]
        public async Task<IActionResult> GetAllList()
        {
            var list = await _departmentService.GetListAsync();
            var result = _mapper.Map<List<DepartmentDto>>(list);
            return Success(result);
        }
    }
}
